package client.ihm.view;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JComponent;
import javax.swing.JFrame;

public class VisitorLayerContainer {

    public static void showOnFrame(JComponent component, String frameName, int posx,int posy ) {
        final JFrame frame = new JFrame(frameName);
        frame.addWindowListener( new WindowAdapter() {

            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }

            public void windowActivated(WindowEvent e) {
                //***IMPERATIF***
                frame.getContentPane().requestFocus();
            }
        });
        //frame.getContentPane().add(component);
        frame.setContentPane(component);
        frame.setLocation(posx, posy);
        frame.pack();
        frame.setVisible(true);
    }
}
